package com.start.shop.api.vo.goods;

import lombok.Data;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import com.start.shop.modules.repository.entity.SkuAttr;

/**
 * Title: ${file_name}
 * Description:
 * Copyright: Copyright (c) 2020
 * Company: www.parpur.com
 *
 * @author fanrg
 * @version 1.0
 * @date ${date}
 */
//
//skuAttrList:[
//        attr:{key：{"id":1, name:规格， sort:1}, value：{"id":1, name:大杯， sort:1}},
//        attr:{key：{"id":1, name:甜度， sort:2}, value：{"id":1, name:无糖， sort:2}}
//        ]

@Data
public class SkuAttrVo {
    private String key;
    private List<String> value;
    
    public static SkuAttrVo setData(SkuAttr key, List<SkuAttr> value) {
    	SkuAttrVo skuAttrVo = new SkuAttrVo();
    	skuAttrVo.setKey(key.getAttrName());
    	List<String> list = new ArrayList<String>();
    	for (int i = 0; i < value.size(); i++) {
			list.add(value.get(i).getAttrName());
		}
    	skuAttrVo.setValue(list);
    	return skuAttrVo;
    }
}
